package org.rzp.ideaplug;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;

import java.util.List;

@Data
public class TableResponse<T> {
    private int code = 0;
    private String msg;
    private long count;
    private List<T> data;


    public static <T> TableResponse<T> convert(Page<T> page) {
        TableResponse<T> response = new TableResponse<>();
        response.setData(page.getRecords());
        response.setCount(page.getTotal());
        return response;
    }
}
